<html>
<head>
    <title>透析助手</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.5.6/css/sm.min.css">
    <link rel="stylesheet" href="__PUBLIC__/css/style.css">
    <link rel="stylesheet" href="__PUBLIC__/css/5s.css">
    <link rel="stylesheet" href="__PUBLIC__/css/6m.css">
    <link rel="stylesheet" href="__PUBLIC__/css/iconfont.css">
</head>
<body>
	<div class="head">
		<div class="HeadContent">
			<span>
                <strong onclick="location.href='<{:U('Doctor/info')}>'"><{$userInfo.name}></strong>
                <{:$userInfo['type']=='1'?'大夫':'营养师'}>，欢迎您！
            </span>
		</div>
	</div>
	<div class="PersonalHead">
		<div class="PersonalHeadImg" onclick="javascript:$('.phonePop').show();">
			<a href="javascript:;"><img src="__PUBLIC__/images/Addperson.png"/></a>
		</div>
		<div class="PerpleNum">
            <if condition="$userInfo['type'] eq '1'">
                <span>患者总人数<{$patientNum}>&nbsp;/</span><span class="warning">达标人数<{$sefeWeightNum}></span>
            <else />
                <span>患者总人数<{$patientNum}>&nbsp;&nbsp;&nbsp;</span>
            </if>
		</div>
	</div>
	<div class="NewsList">
		<ul class="rank_list">
            <foreach name="newsList" item="v">
                <li>
                    <a href="<{:U('news',array('id'=>$v['id']))}>">
                        <div class="NewsTitle">
                            <{$v.name}>
                        </div>
                        <div class="NewsContent"><{$v.content}></div>
                    </a>
                </li>
            </foreach>
		</ul>
	</div>
	<div class="FootNav">
		<ul>
			<li>
				<a href="<{:U('Patient/msg')}>"> <b><{$noReadNum|default='0'}></b> 我的消息 </a>
			</li>
			<li>
				<a href="<{:U('Patient/lists')}>"> 我的患者 </a>
			</li>
			<li>
				<a href="<{:U('Personal/score')}>"> 积分 </a>
			</li>
		</ul>
	</div>
    <!-- 添加患者开始 -->
    <div class="Popwindow phonePop">
        <div class="PopContent">
            <div class="PopContentTitle">请输入患者手机号</div>
                <div class="PopContentText">
                    <div class="PopContentText-input">
                    <input type="tel" id="userPhone" placeholder="请输入" />
                </div>
                <div class="BtnGroup Btn-Popwindow">
                    <button class="btn-drop" onclick="javascript:$('.phonePop').hide();">取消</button>
                    <button class="btn-submit" onclick="savePhone()">确定</button>     
                </div>
            </div>
        </div>
    </div>
    <!-- 添加患者结束 -->
    <div class="Popwindow patientPop">
        <div class="PopContent">
            <div class="PopContentTitle" >提示</div>
                <div class="PopContentText">
                    <p>该手机号码用户<br />已加入“透析助手”微信平台。<br />请直接联系用户修改</p>
                    <div class="BtnGroup Btn-Popwindow">
                    <button class="AddRecord btn-submit" onclick="javascript:$('.patientPop').hide();">确定</button>     
                </div>
            </div>
        </div>
    </div>
<script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
<script type='text/javascript' src='//g.alicdn.com/msui/sm/0.5.7/js/sm.min.js' charset='utf-8'></script>
<script type='text/javascript' src='__PUBLIC__/js/myjq.js'></script>
<script type="text/javascript">
    //无限加载
    var pageNum=1;
    var page_ajax=true;//加载开关
    $(document).ready(function(){
        $(window).scroll(function(){
            var bot = 70; //bot是底部距离的高度
            if ((bot + $(window).scrollTop()) >= ($(document).height() - $(window).height())) {
                if(page_ajax){
                    page_ajax=false;
                    pageNum++;
                    $.get('<{:U("getNews")}>&p='+pageNum,function(res){
                        if(res){
                            if(res != 'err'){
                                var goodsStr='';
                                $.each(res,function(i,item){
                                    goodsStr+='<li><a href="<{:U("news")}>&id='+item.id+'"><div class="NewsTitle">'+item.name+'</div><div class="NewsContent">'+item.content+'</div></a></li>';
                                })
                                $('.rank_list').append(goodsStr);
                                page_ajax=true;
                            }
                        }
                    },'json');
                }
            }
        });
    });
    
    //患者手机号确定
    function savePhone(){
        if(!isMobil($('#userPhone').val())){
            $.toast('请输入正确的手机号');return;
        }
        loadingShow();
        $.post('<{:U("addPatientPhone")}>',{phone:$('#userPhone').val()},function(res){
            loadingHide();
            if(res=='cf'){
                $('.phonePop').hide();
                $('.patientPop').show();
            }else if(res=='suc'){
                $.toast('发送成功');
                setTimeout("$('.phonePop').hide()",500);
            }else{
                $.toast('发送失败');
                setTimeout("$('.phonePop').hide()",800);
            }
        });
    }
</script>
</body>
</html>